<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script language="javascript" type="text/javascript" src="http://manager.zyttb.com/Public/Manage/Js/jquery.js"></script>
<script src="http://manager.zyttb.com/Public/Manage/Js/frame.js" language="javascript" type="text/javascript"></script>
<link href="http://manager.zyttb.com/Public/Manage/Css/style.css" rel="stylesheet" type="text/css" />

<!--[if IE 6]>
<script src="http://manager.zyttb.com/Public/Manage/Js/DD_belatedPNG.js" language="javascript" type="text/javascript"></script>
<script>
  DD_belatedPNG.fix('.nav ul li a,.top_link ul li,background');   /* string argument can be any CSS selector */
</script>
<![endif]-->
</head>
<body class="showmenu">
<link type="text/css" rel="stylesheet" href="http://manager.zyttb.com/Public/Manage/Css/jquery-tag.css" />
<table width="100%" height="31px" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31">
			<div class="titlebt">
				<?php if(I('get.do')=='addGame'): ?>添加游戏
				<?php else: ?>
					修改游戏<?php endif; ?>
			</div>
		</td>
      </tr>
    </table>

<div class="main">

	<div class="form">
		<?php $do = I('get.do'); ?>
		<form method='post' id="form_do" name="form_do" action="<?php echo U('Game/Lists', 'do=' . $do);?>">
			<input type="hidden" name="game_id" value="<?php echo ($game["game_id"]); ?>" />
		<dl>
			<dt> <span class="red">* </span>标题：</dt>
			<dd>
				<input type="text" name="game_name" class="inp_one" id="game_name" value="<?php echo ($game["game_name"]); ?>" placeholder="游戏名称" />
			</dd>
		</dl>

			<dl>
				<dt> <span class="red">* </span> 字母索引：</dt>
				<dd>
					<input type="text" name="initial" class="inp_one" id="fistname" value="<?php echo ($game["game_name_initials"]); ?>" placeholder="游戏名称首字母" />
				</dd>
			</dl>

			<dl>
				<dt> <span class="red">* </span> 充值类型：</dt>
				<dd>
					<select name="recharge" class="recharge" value="<?php echo ($game["game_recharge_class"]); ?>">
						<?php if(is_array($recharge_list)): $i = 0; $__LIST__ = $recharge_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if($game['game_recharge_class'] == $vo['common_class_id'] && $game['game_is_recharge'] == 1): ?><option value="<?php echo ($vo["common_class_id"]); ?>" selected="selected"><?php echo ($vo["common_class_name"]); ?></option>
							<?php else: ?>
								<option value="<?php echo ($vo["common_class_id"]); ?>"><?php echo ($vo["common_class_name"]); ?></option><?php endif; endforeach; endif; else: echo "" ;endif; ?>
						<?php if($game['game_is_recharge'] == 0): $is_show_currency = ' style="display:none;"'; ?>
							<option value="0" selected="selected">不允许充值</option>
						<?php else: ?>
							<?php $is_show_currency = ''; ?>
							<option value="0">不允许充值</option><?php endif; ?>
					</select>
				</dd>
			</dl>
			<div class="game-currency"<?php echo ($is_show_currency); ?>>
				<dl>
					<dt> 游戏币名称：</dt>
					<dd>
						<input type="text" name="currency" class="inp_one currency" value="<?php echo ($game["currency"]); ?>" placeholder="元宝" />
					</dd>
				</dl>

				<dl>
					<dt> 兑换比例：</dt>
					<dd>
						<input type="text" name="ratio" class="inp_one ratio" value="<?php echo ($game["ratio"]); ?>" placeholder="通币:游戏币/1:100" />
					</dd>
				</dl>
			</div>
		<dl>
			<dt> <span class="red">* </span> 所属分类：</dt>
			<dd>
					<select id="select0">
						<?php if(is_array($gamefl)): $i = 0; $__LIST__ = $gamefl;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if($vo['class_id'] == $game['class_parent_id']): ?><option value="<?php echo ($vo["class_id"]); ?>" class="selects" selected="selected"><?php echo ($vo["class_name"]); ?></option>
						<?php else: ?>
							<option value="<?php echo ($vo["class_id"]); ?>" class="selects"><?php echo ($vo["class_name"]); ?></option><?php endif; endforeach; endif; else: echo "" ;endif; ?>
					</select>
					<select id="select1">
						<?php if(empty($gamefl2)): ?><option value="0" class="selects1">游戏类型</option><?php endif; ?>

						<?php if(is_array($gamefl2)): $i = 0; $__LIST__ = $gamefl2;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if($vo['class_id'] == $game['game_class_id']): ?><option value="<?php echo ($vo["class_id"]); ?>" class="selects1" selected="selected"><?php echo ($vo["class_name"]); ?></option>
							<?php else: ?>
								<option value="<?php echo ($vo["class_id"]); ?>" class="selects1"><?php echo ($vo["class_name"]); ?></option><?php endif; endforeach; endif; else: echo "" ;endif; ?>
					</select>
				<input type="hidden" name="cid" id="category-id" value="<?php echo ($game["game_class_id"]); ?>" />
			</dd>
		</dl>

		<dl>
			<dt>游戏区服：</dt>
			<dd>
				<div class="plus-tag-add">
					<input type="text" class="inp_one" maxlength="20" placeholder="请添加" />
					<input type="button" class="btn_blue button" value="添加" />
				</div>
				<div class="plus-tag tagbtn clearfix" id="myTags">
					<?php if(is_array($servers)): $i = 0; $__LIST__ = $servers;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><a title="<?php echo ($vo["game_server_name"]); ?>" value="<?php echo ($vo["game_server_id"]); ?>" href="javascript:void(0);"><span><?php echo ($vo["game_server_name"]); ?></span><em></em></a><?php endforeach; endif; else: echo "" ;endif; ?>
				</div>
			</dd>
		</dl>

		<div class="form_b">
			<input type="button" class="btn_blue" id="addGame" value="提 交">
		</div>
	   </form>
	</div>
</div>

<script type="text/javascript" src="http://manager.zyttb.com/Public/Manage/Js/jquery-tag-select.js"></script>
<script type="text/javascript">
	$(function(){
        $('#game_name').blur(function(){
            $.ajax({
                type:'POST',
                url:"<?php echo U('Game/fistName');?>",
                data:{
                    name:$('#game_name').val()
                },
                success:function(response){
                    $('#fistname').val(response);
                }
            })
        })
		$('#select0').blur(function(){
			$.ajax({
				type:'POST',
				url:"<?php echo U('Game/Lists', 'do=selectlist');?>",
				data:{
					list1:$("#select0").val()
				},
				success:function(response,status,xhr){
					$("#select1").html("");
					$.each(response, function(i, item) {
						$("#select1").append(
								'<option value="'+item.class_id+'">'+item.class_name+'</option>'
						);
					});
				}
			});
		})

		$('#select1').blur(function(){
			var v = parseInt($(this).val());
			if( v > 0 )
				$('#category-id').val( v );
		});

		$('#select0').blur(function(){
			$('#category-id').val('');
		});
	})

	$('#addGame').click(function(){
		$('#form_do').submit();
	});


	$('.recharge').change(function(){
		var v = $(this).val();
		if( v == 0 ){
			$('.currency').val('');
			$('.ratio').val('');
			$('.game-currency').hide();
		}else{
			$('.game-currency').show();
		}
	});
</script>
</body>
</html>